<template>
  <div>
    <button @click="isShow=!isShow">显示/隐藏</button>
    <transition name="title">
      <h1 v-show="isShow">你好啊</h1>
    </transition>
  </div>
</template>

<script>
  export default {
    name:'App',
    data() {
      return {
        isShow:true
      }
    },
  }
</script>

<style>
  * {
    margin: 0;
    padding: 0;
  }
  button{
    font-size: 40px;
  }
  h1 {
    background-color: orange;
    font-size: 60px;
    transition: 1s linear;
  }
  /* 离开的起点、来的终点 */
  .title-leave,.title-enter-to {
    transform: translateX(0);
  }
  /* 离开的终点、来的起点 */
  .title-leave-to,.title-enter {
    transform: translateX(-100%);
  }

</style>